package com.uls.web.controller.czj;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.uls.common.annotation.Log;
import com.uls.common.core.controller.BaseController;
import com.uls.common.core.domain.AjaxResult;
import com.uls.common.enums.BusinessType;
import com.uls.czj.domain.CzjPropertymaintenance;
import com.uls.czj.service.ICzjPropertymaintenanceService;
import com.uls.common.utils.poi.ExcelUtil;
import com.uls.common.core.page.TableDataInfo;

/**
 * 房屋修缮管理Controller
 * 
 * @author czj
 * @date 2024-11-10
 */
@RestController
@RequestMapping("/czj/propertymaintenance")
public class CzjPropertymaintenanceController extends BaseController
{
    @Autowired
    private ICzjPropertymaintenanceService czjPropertymaintenanceService;

    /**
     * 查询房屋修缮管理列表
     */
    @PreAuthorize("@ss.hasPermi('czj:propertymaintenance:list')")
    @GetMapping("/list")
    public TableDataInfo list(CzjPropertymaintenance czjPropertymaintenance)
    {
        startPage();
        List<CzjPropertymaintenance> list = czjPropertymaintenanceService.selectCzjPropertymaintenanceList(czjPropertymaintenance);
        return getDataTable(list);
    }

    /**
     * 导出房屋修缮管理列表
     */
    @PreAuthorize("@ss.hasPermi('czj:propertymaintenance:export')")
    @Log(title = "房屋修缮管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, CzjPropertymaintenance czjPropertymaintenance)
    {
        List<CzjPropertymaintenance> list = czjPropertymaintenanceService.selectCzjPropertymaintenanceList(czjPropertymaintenance);
        ExcelUtil<CzjPropertymaintenance> util = new ExcelUtil<CzjPropertymaintenance>(CzjPropertymaintenance.class);
        util.exportExcel(response, list, "房屋修缮管理数据");
    }

    /**
     * 获取房屋修缮管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('czj:propertymaintenance:query')")
    @GetMapping(value = "/{maintenanceid}")
    public AjaxResult getInfo(@PathVariable("maintenanceid") Long maintenanceid)
    {
        return success(czjPropertymaintenanceService.selectCzjPropertymaintenanceByMaintenanceid(maintenanceid));
    }

    /**
     * 新增房屋修缮管理
     */
    @PreAuthorize("@ss.hasPermi('czj:propertymaintenance:add')")
    @Log(title = "房屋修缮管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CzjPropertymaintenance czjPropertymaintenance)
    {
        return toAjax(czjPropertymaintenanceService.insertCzjPropertymaintenance(czjPropertymaintenance));
    }

    /**
     * 修改房屋修缮管理
     */
    @PreAuthorize("@ss.hasPermi('czj:propertymaintenance:edit')")
    @Log(title = "房屋修缮管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CzjPropertymaintenance czjPropertymaintenance)
    {
        return toAjax(czjPropertymaintenanceService.updateCzjPropertymaintenance(czjPropertymaintenance));
    }

    /**
     * 删除房屋修缮管理
     */
    @PreAuthorize("@ss.hasPermi('czj:propertymaintenance:remove')")
    @Log(title = "房屋修缮管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{maintenanceids}")
    public AjaxResult remove(@PathVariable Long[] maintenanceids)
    {
        return toAjax(czjPropertymaintenanceService.deleteCzjPropertymaintenanceByMaintenanceids(maintenanceids));
    }
}
